// console.log(process)
// console.log(buffer)
const { log } = console

// 当前根目录
// log(process.cwd())
// 
log(process.pid)
// 接收用户输入的参数
// log(process.argv.slice(2))

// // 将数组转化成对象
// const obj = process.argv.slice(2).reduce((memo,current,index,array)=>{
//     if(current.includes('--')) {
//         memo[current.slice(2)] = array[index+1]
//     }
//     return memo;
// },{})

// log(obj)

// log(process.env)

// log(require)
// log(exports)
log(module)
log(this)
log(this == module.exports) // true
// 当前文件
log(__filename)
// 当前文件夹
log(__dirname)
// 根目录!Q
log(process.cwd())
// log(global)

// (function(){
//     console.log(this === global) // true
// })();
log(this == module.exports)

async function async1() {
    console.log('async1 start')
    await async2()
    console.log('async1 end')
}

async function async2() {
    console.log('async2')
}

console.log('script start')

setTimeout(function () {
    console.log('setTimeout')
}, 0)
async1()
new Promise(function (resolve) {
    console.log('promise1')
    resolve();
}).then(function () {
    console.log('promise2')
})
console.log('script end')